home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sea_wallblast.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  241 lines

  1. # Jones 3D Cog Script
  2. #
  3. # sea_wallblast.cog
  4. #
  5. # Cog description
  6. #
  7. # [RD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12. symbols
  13.  
  14. message    startup
  15. message    activated
  16. message    damaged
  17. message    pulse
  18.  
  19. surface    crackedwall                    mask=0x408
  20.  
  21. sound        explosion=gen_bazooka_fire.wav    local
  22. sound       sfxCharge=imp1_chargeup.wav         local
  23. sound        indysay=inxj025.wav            local #This wall looks ready to crumble.
  24. thing       bombpos                    local
  25. thing        dust                        local
  26. thing        player                    local
  27. template    dusttemp=dustcloud            local        
  28. template    debris=stnshrapas_nc_ns            local
  29. template    bomb=ghost                    local
  30. material    dustmat=gen_a4sfx_dustcloud.mat    local
  31. int        fragment=0                    local
  32. int        i=0                        local
  33. int        vibe                        local
  34. int        speak0                    local
  35. flex        blowitup                    local
  36. vector    angoffset                    local
  37. vector    posoffset                    local
  38.  
  39. # .............. INDY SAY LINES ..................................................
  40.     int    lineindex                    local # indexes sound array
  41.  
  42. # wrong item...
  43.     sound    in_itemline0=Inxj089.wav        local # That didn't work.
  44.     sound    in_itemline1=Inxj090.wav        local # ...something wrong.
  45.     sound    in_itemline2=Inxj092.wav        local # Hmm...didn't quite work.
  46.     sound    in_itemline3=Inxj060.wav        local # I don't think...right answer.
  47.     sound    in_itemline4=Inxj087.wav        local # Whoops.
  48.     sound    in_itemline5=Inxj088.wav        local # Nope.
  49.     sound    in_itemline6=Inxj091.wav        local # Of course that didn't work.    
  50.     int    wi_newline=50                local
  51.     int    wi_oldline=50                local
  52.     flex        randwrongitemlines                local
  53.     int    wrongitemoffset                local
  54.  
  55.  
  56.  
  57.  
  58. end
  59. # -------------------------------------------------------------------
  60.  
  61. code
  62. startup:
  63.     Sleep(.3);
  64.     player = GetLocalPlayerThing();
  65.     ClearAdjoinFlags(crackedwall, 2);
  66.     ClearAdjoinFlags(GetSurfaceAdjoin(crackedwall), 2);
  67.     SetFaceGeoMode(crackedwall, 4);
  68.     SetFaceGeoMode(GetSurfaceAdjoin(crackedwall), 4);
  69.     bombpos = CreateThingAtPos(bomb, GetSurfaceSector(crackedwall), GetSurfaceCenter(crackedwall), VectorSet(0, 0, 0));
  70.     CaptureThing(bombpos);
  71.     return;
  72.  
  73. damaged:
  74.     if (GetCurWeapon(player) != 14) return;                #if not holding MP1
  75.     if (GetParam(1) != 0x1000) return;                    #if damage wasn't caused by MP1
  76.     call blowitup;
  77.     return;
  78.  
  79. activated:
  80.     if (GetCurWeapon(player) == 14) return;
  81.     if(getsenderref() == crackedwall)
  82.     {
  83.     SetActorFlags(player, 0x200000);
  84.     MakeMeStop();
  85.     DeselectWeaponWait(player);
  86.     StartCutscene(0);
  87.  
  88.     # ----- Set Cam Offset ---------
  89.     if (Rand() < 0.5)
  90.     {
  91.         SetExtCamOffset('0.10 -0.06 0.05');
  92.     }
  93.     else
  94.     {
  95.         SetExtCamOffset('-0.10 -0.06 0.05');
  96.     }
  97.     SetExtCamLookOffset('0.0 0.02 0.0');
  98.  
  99.       PlayMode(player, 60, 0);
  100.  
  101.     # player is using a wrong item
  102.           if (GetCurItem(player) >= 1)
  103.         {
  104.         sleep(0.5);
  105.         call randwrongitemlines;
  106.         }
  107.     # player isn't using anything
  108.         else
  109.         {
  110.         sleep(0.5);
  111.         speak0 = PlayVoice(player, indysay, 1.0, 1);
  112.         }
  113.         WaitForSound(speak0);
  114.  
  115.     RestoreExtCam();
  116.     ClearActorFlags(player, 0x200000);
  117.     EndCutscene();
  118.     return;
  119.     }
  120.     return;
  121.     
  122. blowitup:
  123.     SetActorFlags(player, 0x200000);
  124.     MakeMeStop();
  125.     StartCutscene(0);
  126.  
  127.     # ----- Set Cam Offset ---------
  128.     if (Rand() < 0.5)
  129.     {
  130.         SetExtCamOffset('0.10 -0.06 0.07');
  131.     }
  132.     else
  133.     {
  134.         SetExtCamOffset('-0.10 -0.06 0.07');
  135.     }
  136.     SetExtCamLookOffset('0.0 0.02 0.0');
  137.  
  138.     sleep(0.3);
  139.     setPulse(0.01);
  140.  
  141.     PlaySoundLocal(sfxCharge, 1.0, 0.0, 0x0, 0);
  142.     Sleep(1.5);
  143.  
  144.     PlaySoundLocal(explosion, 1, 0, 0x0, 0);
  145.     SetAdjoinFlags(crackedwall, 2);
  146.     SetAdjoinFlags(GetSurfaceAdjoin(crackedwall), 2);
  147.     for(i=0; i<40; i=i+1)
  148.     {
  149.         fragment = CreateThing(debris, bombpos);                                 
  150.           SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 2));
  151.           SetThingRotVel(fragment, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 900.0));                    
  152.     } 
  153.     SetFaceGeoMode(crackedwall, 0);
  154.     SetFaceGeoMode(GetSurfaceAdjoin(crackedwall), 0);
  155.     dust=CreateThing(dusttemp,bombpos);
  156.     MaterialAnim(dustmat, 8.0, 0);
  157.     AnimateSpriteSize(dust, '0.02 0.02 1.0', '0.4 0.4 0.5', 1.0);
  158.     sleep(1.0);
  159.     setPulse(0.0);
  160.     Destroything(dust);
  161.  
  162.     RestoreExtCam();
  163.     ClearActorFlags(player, 0x200000);
  164.     EndCutscene();
  165.     return;
  166.  
  167. pulse:
  168.     vibe = RandBetween(1, 4);
  169.     if (vibe == 1)
  170.     {
  171.         posOffset = '-0.005 0.00 -0.001'; 
  172.         angOffset = '0.00 -0.001 0.001';
  173.     }
  174.     if (vibe == 2)
  175.     {
  176.         posOffset = '0.005 -0.002 0.001';
  177.         angOffset = '0.001 0.00 -0.001';
  178.     }
  179.     if (vibe == 3)
  180.     {
  181.         posOffset = '0.002 0.002 -0.002';
  182.         angOffset = '-0.001 0.002 -0.002';
  183.     }
  184.     if (vibe == 4)
  185.     {
  186.         posOffset = '-0.001 0.00 0.002';
  187.         angOffset = '0.00 0.00 0.001';
  188.     }
  189.     vibe = RandBetween(1, 3);
  190.     if (vibe == 1)
  191.     {
  192.         SetPulse(0.05);
  193.     }
  194.     if (vibe == 2)
  195.     {
  196.         SetPulse(0.1);
  197.     }
  198.     if (vibe == 3)
  199.     {
  200.         SetPulse(0.15);
  201.     }
  202.     SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  203.     return;
  204.  
  205. #=====================================================================
  206. #        Wrong Item lines
  207. #=====================================================================
  208. randwrongitemlines:
  209.  
  210.     while (wi_newline == wi_oldline)
  211.     {        
  212.         wi_newline = RandBetween(0, 19);
  213.         if (wi_newline < 15)
  214.         {    
  215.             wi_newline = RandBetween(0, 3); # ~1/5 chance for lines 0 thru 3
  216.         }
  217.         if (wi_newline == 19)
  218.         {
  219.             wi_newline = 6; # 1/20 chance for line 6 
  220.         }
  221.         if (wi_newline > 16)
  222.         {
  223.             wi_newline = 5; # 1/10 chance for line 5 
  224.         }
  225.         if (wi_newline > 14)
  226.         {
  227.             wi_newline = 4; # 1/10 chance for line 4
  228.         }
  229.     }
  230.     wi_oldline = wi_newline;    
  231.     lineindex = wrongitemoffset + wi_newline;
  232.     speak0 = PlayVoice(player, in_itemline0[lineindex], 1, 1);
  233.     return;
  234.  
  235.  
  236. end
  237.  
  238.  
  239.  
  240.  
  241.